package com.fg.zrcommunity.common;

import lombok.Data;

/**
 * 统一的返回数据的格式
 */
@Data
public class ResultInfo {

    private int code; //状态码
    private String msg; //状态信息
    private Object data; //数据

    public void ok() {
        code = 200;
        msg = "ok";
    }

    public void ok(Object data) {
        ok();
        this.data = data;
    }

    public void error() {
        code = 500;
        msg = "error";
    }

    public void error(Exception e) {
        code = 500;
        msg = e.getMessage();
    }
}
